using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using Utility;
using BUS;

public partial class Admin_DiaDiemEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadData();
    }
    private void LoadData()
    {
        try
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            tbDiaDiem dd = tbDiaDiemBUS.GetByID(id);
            if (dd != null)
            {
                txt_dd.Text = dd.DiaDiem.ToString();
                TextBox1.Text = dd.IDDiaDiem.ToString();
            }
        }
        catch
        {
            Response.Redirect("~/Admin/DiaDiemList.aspx");
        }
    }
    protected void btdd_them_Click(object sender, EventArgs e)
    {
        try
        {
            tbDiaDiem dd = tbDiaDiemBUS.GetByID(int.Parse(TextBox1.Text));
            dd.DiaDiem = txt_dd.Text;
            tbDiaDiemBUS.Update_DiaDiem(dd);
        }
        catch
        {
            Response.Redirect("~/Admin/DiaDiemList.aspx");
        }
    }
}
